<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

</body>
<script>
  let arr = [100, 23, 10, 234, 0];
  console.log(arr.sort((a, b) => {
    return a - b;
  }));

  let list = [{
    name: "iphone",
    price: 3000
  }, {
    name: "小米",
    price: 4211
  }, {
    name: "华为",
    price: 1000
  }];

  list = list.sort((a, b) => {
    return b.price - a.price;
  });

  console.table(list);
</script>

</html>